package com.atguigu.jxc.controller;

import com.atguigu.jxc.domain.ServiceVO;
import com.atguigu.jxc.service.GoodTypeService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * ClassName: GoodTypeController
 * Package: com.atguigu.jxc.controller
 *
 * @Description:
 * @Author: xvyy
 * @Create: 2025/2/21 - 16:14
 * @Version: v1.0
 */
@RestController
@RequestMapping("/goodsType")
public class GoodTypeController {

    @Autowired
    private GoodTypeService goodTypeService;

    @PostMapping("/loadGoodsType")
    @RequiresPermissions(value = "商品管理")
    public String loadGoodsType() {
        return goodTypeService.loadGoodsType();
    }

    @PostMapping("/save")
    public ServiceVO save(String goodsTypeName, Integer pId) {
        return goodTypeService.save(goodsTypeName , pId);
    }

    @PostMapping("/delete")
    public ServiceVO delete(Integer  goodsTypeId) {
        return goodTypeService.delete(goodsTypeId);
    }
}
